package com.example.arch.room;

import android.arch.persistence.room.Room;
import com.example.App;

/**
 * Created by zhangwei on 2017/6/27.
 */
public class DbHelper {
    private static DbHelper ourInstance;

    public static DbHelper getInstance() {
        if (ourInstance == null) {
            ourInstance = new DbHelper();
        }
        return ourInstance;
    }


    private AppDatabase db;
    private DbHelper() {
        db = Room.databaseBuilder(App.getInstance(), AppDatabase.class, "data.db").build();
    }

    public AppDatabase getDb() {
        return db;
    }
}
